home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Day Cry
/
Day Cry CD.bin
/
oh_towns
/
tetujin
/
src.lzh
/
TETUSUB.C
< prev
Wrap
Text File
|
1994-09-09
|
60KB
|
2,405 lines
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winb.h>
#include <te.h>
#include <fntb.h>
#include <gui.h>
#include <file_dlg.h>
#include <wgb.h>
#include <egb.h>
#include <mos.h>
#include <snd.h>
#include <tifflib.h>
#include <guidbg.h>
#include "tetujin.h"
#include "poly.h"
#include "g_eff.h"
#undef SHADE_SIZE /* gui.hé┼é═2é╛é¬é▒é╠programé╔î└é┴é─ï¡ÉºôIé╔0 */
#define SHADE_SIZE 0
#define EFFECTCOUNT 10
/* abou */
int alertId = -1 ;
int messageId[4] = -1 ;
int dspIconId = -1 ;
int aboutOKBtnId = -1 ;
int aboutNumId = -1 ;
/* desk */
int baseDialogId = -1 ;
int menubarId = -1 ;
int menuId = -1 ;
int mItemId[3] = -1 ;
int SDKmenuId = -1 ;
int SDKmItemId[3] = -1 ;
int fileMenuId = -1 ;
int fileMItemId[3] = -1 ;
int effectMenuId = -1 ;
int effectMItemId[EFFECTCOUNT] = -1 ;
int effectSpaceMItemId = -1 ;
int effectUndoMItemId = -1 ;
int quitIconId = -1 ;
int outIconId = -1 ;
/* error */
int errorId = -1 ;
int errorOKBtnId = -1 ;
int errorIconId = -1 ;
int errormessage[2] = -1 ;
/* set */
int baseSetupDialogId = -1 ;
int baseSetupDialogId2 = -1 ;
int baseSetupMesId[10] = -1 ;
int baseSetupModeTitleMesId = -1 ;
int baseSetupNumId[4] = -1 ;
int setupTIconId[6] = -1 ;
int setupAreaTIconId[3] = -1 ;
int baseSetupModeMesId[6] = -1 ;
int baseScrId[4] = -1 ;
int baseSDBtnId[2] = -1 ;
int baseSetupTitleMesId = -1 ;
/* filesâIâvâVâçâôùp */
int fileSubDialogId = -1 ;
int fileBtnId[3] = -1 ;
int fileMesId[3] = -1 ;
/* windowùpëeé╠æ╢ì▌ */
int windowId = -1 ;
int vscrollId = -1 ;
int hscrollId = -1 ;
/* Ä└æ╘(âüâCâôâ\ü[âXé╔é─ëeé⌐éτì∞éΦé╛é╖Ä└æ╘) */
GRAPHWIN window[WINCOUNT] = -1 ; /* windowÄ└æ╘kobj */
int boundWidth ; /* ëíé╠ë≡æ£ôx(512/640) */
static int effectNum = -1 ;
BASICSET effectSet[EFFECTCOUNT] = {
{ "ò╜èèë╗âtâBâïâ^",
3,
"ì¼ìçöΣ(0ü`100)", 100, 0, 100,
"ï¡é│(0ü`100)", 80, 0, 100,
"ù╓èsÉⁿò█æ╢(0ü`100)", 50, 0, 100,
"", 0, 0, 100,
0,
"",
"",
"",
"",
"",
"",
"",
0,
0
},
{ "âVââü[âvâlâX",
3,
"ì¼ìçöΣ(0ü`100)", 100, 0, 100,
"ï¡é│(0ü`100)", 80, 0, 100,
"âmâCâYæjÄ~(0ü`100)", 50, 0, 100,
"", 0, 0, 100,
0,
"",
"",
"",
"",
"",
"",
"",
0,
0
},
{ "âüâfâBâAâôüEâtâBâïâ^",
2,
"ì¼ìçöΣ(0ü`100)", 100, 0, 100,
"ù╓èsÉⁿò█æ╢(0ü`100)", 30, 0, 100,
"", 0, 0, 100,
"", 0, 0, 100,
0,
"",
"",
"",
"",
"",
"",
"",
0,
0
},
{ "âfâWâ^âCâYüEâXâÇü[âT",
1,
"ì¼ìçöΣ(0ü`100)", 100, 0, 100,
"", 0, 0, 100,
"", 0, 0, 100,
"", 0, 0, 100,
4,
"âéü[âh",
"è∩ÉöâëâCâô(Äπ)",
"è∩ÉöâëâCâô(ï¡)",
"ï⌠ÉöâëâCâô(Äπ)",
"ï⌠ÉöâëâCâô(ï¡)",
"",
"",
0,
0
},
{ "âtâ@âWâBüEâîâKü[âg",
2,
"ì¼ìçöΣ(0ü`100)", 100, 0, 100,
"âZâôâTü[(0ü`100)", 88, 0, 100,
"", 0, 0, 100,
"", 0, 0, 100,
0,
"",
"",
"",
"",
"",
"",
"",
0,
0
},
{ "ïPôxâfü[â^é╠ò╜ÆRë╗(ùvÄ₧è╘)",
3,
"ì¼ìçöΣ(0ü`100)", 100, 0, 100,
"ïPôxì┼żÆl(0ü`255)", 0, 0, 255,
"ïPôxì┼æσÆl(0ü`255)", 255, 0, 255,
"", 0, 0, 100,
2,
"ïPôxö═ê═é╠É▌ÆΦò√û@",
"ÄΦ ô«",
"Ä⌐ ô«",
"",
"",
"",
"",
0,
0
},
{ "ÉFé╠ì─özÆu(ùvÆ╖Ä₧è╘)",
1,
"ì¼ìçöΣ(0ü`100)", 100, 0, 100,
"", 0, 0, 100,
"", 0, 0, 100,
"", 0, 0, 100,
3,
"âéü[âh",
"ÉFé╠ì╠ÅW",
"ÉFé╠ò╜ÆRì─özÆu",
"ÉFé╠ÆPÅâì─özÆu",
"",
"",
"",
0,
0
},
{ "YUVò╧è╖ & î╕èKÆ▓",
4,
"ì¼ìçöΣ(0ü`100)", 100, 0, 100,
"ïPôx(Y) é╠èKÆ▓", 64, 0, 256,
"ÉFæè(Cb)é╠èKÆ▓", 16, 0, 256,
"ÉFæè(Cr)é╠èKÆ▓", 16, 0, 256,
4,
"ÉFæèé╠é▄é╤é½",
"é▄é╤é½é╚é╡",
"ëíò√îⁿé▄é╤é½",
"Åcò√îⁿé▄é╤é½",
"Åc ëí é▄é╤é½",
"",
"",
0,
0
}
} ;
char polygonBuffer[ 640*512/8 ] ; /* â|âèâSâôÄwÆΦì∞ï╞ù╠êµ */
char tifPath[100] ; /* ô╟é▌ì₧é▌âpâXû╝ */
char *undoBuf = NULL ; /* âAâôâhâEâoâbâtâ@ */
char *alphaBuf = NULL ;
int undoLot = 0 ;
int outMode = 0 ; /* 0:normal display 1:ègæσ display */
static int actId ; /* é╟é╠âEâBâôâhâEé¬âAâNâeâBâué⌐é≡é╡é▀é╖ò╧Éö */
static int windowflg = 0 ; /* âEâBâôâhâEé¬ë╜ûçèJéóé─éóéΘé⌐é≡é╡é▀é╖ò╧Éö */
static int outLupx, outLupy ; /* ègæσÄ₧é╠ò\Īì╢Åπì└òW */
static int saveMode = 0 ; /* save mode 0:1600û£ÉF 1:32768ÉF */
static int saveCompMode = 0 ; /* save mode 0:normal, 1:comp. */
extern char *guiEgbPtr ; /* EGB é╠âÅü[âNâAâhâîâX */
/***** âGâtâFâNâgâRâ}âôâhÄ└ìsâïü[â`âô *****/
static execx, execy, execAreaMode ; /* âèü[âh&âëâCâgè╓Éöùpé╠ò╧Éö */
static char *execOutBuf ;
/* âAâôâhâDâoâbâtâ@é⌐éτé╠âèü[âhè╓Éö */
static int execRead1( int x, int y, unsigned char *a )
{
if( x < 0 )x = 0 ;
if( y < 0 )y = 0 ;
if( x >= execx )x = execx - 1 ;
if( y >= execy )y = execy - 1 ;
DWORD( a ) = DWORD( undoBuf + (y*execx + x)*3 ) ;
if( execAreaMode < 2 )
a[3] = getArea( x, y ) ;
else
a[3] = 1 ;
return NOERR ;
}
/* âAâEâgâvâbâgâoâbâtâ@é⌐éτé╠âèü[âhè╓Éö */
static int execRead2( int x, int y, unsigned char *a )
{
if( x < 0 )x = 0 ;
if( y < 0 )y = 0 ;
if( x >= execx )x = execx - 1 ;
if( y >= execy )y = execy - 1 ;
DWORD( a ) = DWORD( execOutBuf + (y*execx + x)*3 ) ;
if( execAreaMode < 2 )
a[3] = getArea( x, y ) ;
else
a[3] = 1 ;
return NOERR ;
}
/* âAâEâgâvâbâgâoâbâtâ@é╓é╠âëâCâgè╓Éö */
static int execWrite( int x, int y, unsigned char *a )
{
int d ;
if( x < 0 )x = 0 ;
if( y < 0 )y = 0 ;
if( x >= execx )x = execx - 1 ;
if( y >= execy )y = execy - 1 ;
d = (y*execx + x)*3 ;
WORD( execOutBuf + d ) = WORD( a ) ;
BYTE( execOutBuf + d + 2 ) = BYTE( a + 2 ) ;
return NOERR ;
}
/* â}âXâNâoâbâtâ@é⌐éτé╠âèü[âhè╓Éö */
static int execMask( int x, int y )
{
return 0 ;
}
/* âGâtâFâNâgÄ└ìs */
static int execEffect( FRAME areaFrame )
{
int i, d[5] ;
execOutBuf = window[actId].buf16m ; /* âAâEâgâvâbâgâoâbâtâ@ */
if( effectNum < 0 )return NOERR ; /* effecté╠æIæ≡é¬é╚é│éΩé─é╚éó */
if( windowflg <= 0 )return NOERR ; /* windowé¬èJé⌐éΩé─é╚éó */
if( execOutBuf == NULL )return NOERR ; /* dataé¬é╚éó */
if( undoBuf == NULL )return NOERR ; /* âAâôâhâDâoâbâtâ@é¬é╚éó */
execx = window[actId].dx ; /* èGé╠ëíò¥ */
execy = window[actId].dy ; /* èGé╠Åcò¥ */
if( areaFrame.lupx < 0 )areaFrame.lupx = 0 ; /* é═é▌é╛é╡é≡ÅCÉ│ */
if( areaFrame.lupy < 0 )areaFrame.lupy = 0 ;
if( areaFrame.rdwx > execx-1 )areaFrame.rdwx = execx-1 ;
if( areaFrame.rdwy > execy-1 )areaFrame.rdwy = execy-1 ;
execAreaMode = effectSet[effectNum].areaMode ;
/* âGâèâAÉ▌ÆΦâéü[âh(╬▀╪║▐▌,Älèpî`,æSæ╠é╠ïµò╩)é╠ÆèÅo */
trans( window[actId].buf16m, undoBuf, execx*execy*3 ) ; /* dataü¿undoBuf */
trans( window[actId].bufAlpha, alphaBuf, execx*execy ) ;
for( i=0 ; i<4 ; i++ ) /* É▌ÆΦÆlé╠ÆèÅo */
d[i] = effectSet[effectNum].set[i].prt ;
d[4] = effectSet[effectNum].mode ;
switch( effectNum ) /* âGâtâFâNâgè╓Éöé╠æIæ≡ */
{
case 0:
softnessFilter( areaFrame, d ) ;
break ;
case 1:
sharpnessFilter( areaFrame, d ) ;
break ;
case 2:
medianFilter( areaFrame, d ) ;
break ;
case 3:
digitizeSmooth( areaFrame, d ) ;
break ;
case 4:
fuzzy( areaFrame, d ) ;